home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / Gfx4PCQ.lha / WindowLib / Examples / Jumper / Jumper.p < prev    next >
Encoding:
Text File  |  1997-02-09  |  1.1 KB  |  66 lines

  1. PROGRAM Jumper;
  2. {Another fractal demonstration program, to demonstrate the features of
  3.  THOR's windowlib.
  4.  © 1997 THOR Software.}
  5.  
  6. {$I "Include:Utils/windowlib.i"}
  7.     
  8. VAR
  9.     a,b,c    :    REAL;
  10.     window    :    WindowPtr;    {the pointer to a window}
  11.     
  12.  
  13. {this procedure iterates the fractal}
  14. PROCEDURE Jumper(window : WindowPtr);
  15. VAR
  16.     x,y    :    REAL;        {position}
  17.     tmp    :    REAL;
  18.     i    :    INTEGER;
  19. BEGIN
  20.     
  21.     x:=0;
  22.     y:=0;
  23.  
  24.     {tell windowlib we want to get informed if the user wants to shut down}
  25.     RequestStart(window,CLOSEWINDOW_f);
  26.     REPEAT    
  27.         Plot(window,x+400,32-y/2);    {plot the point}
  28.  
  29.                         {the iteration procedure}
  30.         tmp:=SQRT(ABS(b*x-c));
  31.         IF x=0 THEN
  32.             tmp:=y
  33.         ELSE BEGIN
  34.             IF x>0 THEN
  35.                 tmp:=y-tmp
  36.             ELSE    tmp:=y+tmp
  37.         END;
  38.         y:=a-x;
  39.         x:=tmp;
  40.         {repeat until we know the user shuts down}
  41.     UNTIL NextRequest(window)=CLOSEWINDOW_f;
  42.     
  43. END;
  44.     
  45. BEGIN
  46.     InitGraphics;    {setup gfx system}
  47.     
  48.     {create a window on WB}
  49.     window:=OpenScreenWindow(NIL,0,0,640,200,2+4+8,"Jumper");
  50.     
  51.     IF window<>NIL THEN BEGIN
  52.         a:=-200.0;
  53.         b:=0.1;
  54.         c:=-80;
  55.         
  56.         Color(window,1);    {choose pen}
  57.         
  58.         Jumper(window);        {draw it!}
  59.         
  60.         CloseAWindow(window);    {close the window}
  61.     END;
  62.  
  63.  
  64.     ExitGraphics;            {cleanup gfx}
  65. END.
  66.